<template>
	<div class="llf_content">
		<div class="work_boder work_header">
			<h3>快捷功能</h3>
			<div class="flex_s">
				<div v-for="item in menuList" :key="item.path" @click="onClick(item)">
					<img :src="item.imag" alt="">
					<p>{{item.name}}</p>
				</div>
			</div>
		</div>
		<div class="flex_s wait_box">
			<div class="work_boder work_mind">
				<h3>待诊清单<span v-if="waitList.length > 4">查看全部</span></h3>
				<!-- {{waitList}} -->
				<waitItemList :waitList="waitList" />
			</div>
			<div class="work_boder work_bom">
				<h3 style="justify-content: center;">数据展示</h3>
				<dataShow />
			</div>
		</div>
		<MyDialog v-model:visible="craeteVisible" title="新增患者" :width="800"
			destroyOnClose>
			<template v-slot:content>
				<crateDlg @onReset="craeteVisible = false" @onSubmit="onSubmit" />
			</template>
		</MyDialog>
	</div>
</template>

<script setup lang="ts">
	import { onMounted, ref, computed } from "vue";
	import {useRouter,useRoute} from 'vue-router';
	import { useWorkBenches, useWebstock } from '@/store';
	import crateDlg from "@/views/patientMange/component/cratePatient.vue";
	// import { admin_patinetList } from "@/api/patient";
	import waitItemList from "./component/waitItemList.vue";
	import dataShow from "./component/dataShow.vue";
	import patienticon from "@/assets/image/work/patient.png";
	import reporticon from "@/assets/image/work/report.png";
	
	const ROUTER = useRouter();
	const Workben = useWorkBenches();
	
	const menuList = [
		{ name:'新增患者',path:'add-patient',imag:patienticon },
		{ name:'报告管理',path:'/reportMange',imag:reporticon },
	];
	const craeteVisible = ref(false);
	const waitList = computed(()=> Workben.$state.workerPatientList);
	// const waitList = ref([]);workerPatientList
	
	const onClick = (item)=>{
		const { path } = item;
		if(path == 'add-patient'){
			craeteVisible.value = true;
		}else{
			ROUTER.replace({path:path});
		}
	};
	
	const onSubmit = ()=>{
		console.log(21);
	};
	
	onMounted(async ()=>{
		localStorage.removeItem('currentSort');
		localStorage.removeItem('currentItem');
		localStorage.removeItem('Instvisible');
		// Workben.getList(true);
		// const res = await admin_patinetList({ page:1,size:6 });
		// if(!res) return;
		// if(res.list){
		// 	waitList.value = res.list;
		// }else{
		// 	waitList.value = [];
		// }
	});
	
</script>
<style lang="less" scoped>
	.work_boder{
		height: 169px;
		background-color: @white;
		// border:1px solid @success700;
		border-radius:7px;
		padding:20px;
		box-shadow: 0px 0px 10px 0px #E5E5E5;
	}
	.work_mind{
		flex:2;
		height: 100%;
	}
	.work_bom{
		flex:1;
		margin-left: 20px;
		height: 100%;
	}
	h3{
		font-size: 18px;
		margin-bottom:10px;
		color: #535353;
		display: flex;
		justify-content: space-between;
		span{
			color: #838383;
			font-size: 12px;
			cursor: pointer;
			text-decoration: underline;
		}
	}
	.work_header{
		display: flex;
		flex-direction: column;
		.flex_s{
			flex:1;
		}
		// align-items: center;
		.flex_s >div{
			margin-right:10px;
			cursor: pointer;
			position: relative;
			width: 137px;
			height: 54px;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #535353;
			font-size: 16px;
			&:nth-of-type(1){
				justify-content: left;
			}
			&::after{
				position: absolute;
				content:'';
				background: #DDFBF1;
				width: 2px;
				height: 48px;
				border-radius: 2px;
				top:0;
				right: 0;
			}
			
			&:last-of-type{
				&::after{
					content: '';
					height: 0;
				}
			}
			
			img{
				margin-right: 10px;
			}
		}
	}
	.wait_box{
		flex:1;margin-top:30px;
	}
	// .llf_content{
	// 	background-color:@white;
	// 	border-radius:7px;
	// 	padding: 20px;
	// 	overflow: auto;
	// }
</style>